cmake_minimum_required(VERSION 3.14)

project(template LANGUAGES CXX VERSION 0.0.1)

include(cmake/SparkWithGit.cmake)
spark_initialize_modules()

# 资源文件路径
set(QRC_SOURCES "assets/resource.qrc")

spark_add_executable_path(${PROJECT_NAME} 
    src
    src/dialog
    src/view
    ${QRC_SOURCES}
)
target_link_qt(${PROJECT_NAME})

spark_framework_include_with_git(${PROJECT_NAME} 
    https://gitee.com/spark-framework-libs/spark-framework-features
    FEATURES version screenutil qrcutil)

spark_framework_include_with_git(${PROJECT_NAME}
    https://gitee.com/spark-framework-libs/network-access-libs
    FEATURES httpmanager)

# 在 Windows 中开启 UNICODE 以支持 TCHAR 功能
if(WIN32)
    if(MSVC)
        # MSVC 编译器处理方案，支持 utf-8 编码的项目
        add_compile_options(/utf-8)
    endif(MSVC)
    # Windows 下为目标追加图标资源与目标属性
    add_compile_definitions(_UNICODE= UNICODE=)
    # target_sources(${PROJECT_NAME} PRIVATE icon.rc)
    set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
    include(cmake/windows-deployqt.cmake)
    message("Windows Done.")
    return()
endif(WIN32)

add_subdirectory(tests)
